package io.wins.vertx.entity;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;
import io.wins.vertx.utils.UUIDUtils;
import org.apache.commons.lang3.StringUtils;

@DataObject(generateConverter = true)
public class Customer {
    private final String id;
    private String loginId;
    private String nickname;
    private String realName;
    private boolean sex;
    private String phone;
    private String email;
    private String birthday;
    private String image;
    private String description;
    private boolean isDelete;
    private long createdOn;
    private long updatedOn;

    public Customer(final JsonObject json) {
        CustomerConverter.fromJson(json, this);
        this.id = StringUtils.isEmpty(json.getString("id")) ?
            UUIDUtils.genId() : json.getString("id");
    }

    public JsonObject toJson() {
        final JsonObject json = new JsonObject();
        CustomerConverter.toJson(this, json);
        return json;
    }

    public String getId() {
        return this.id;
    }

    public String getLoginId() {
        return this.loginId;
    }

    public void setLoginId(final String loginId) {
        this.loginId = loginId;
    }

    public String getNickname() {
        return this.nickname;
    }

    public void setNickname(final String nickname) {
        this.nickname = nickname;
    }

    public String getRealName() {
        return this.realName;
    }

    public void setRealName(final String realName) {
        this.realName = realName;
    }

    public boolean isSex() {
        return this.sex;
    }

    public void setSex(final boolean sex) {
        this.sex = sex;
    }

    public String getPhone() {
        return this.phone;
    }

    public void setPhone(final String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return this.email;
    }

    public void setEmail(final String email) {
        this.email = email;
    }

    public String getBirthday() {
        return this.birthday;
    }

    public void setBirthday(final String birthday) {
        this.birthday = birthday;
    }

    public String getImage() {
        return this.image;
    }

    public void setImage(final String image) {
        this.image = image;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(final String description) {
        this.description = description;
    }

    public boolean isDelete() {
        return this.isDelete;
    }

    public void setDelete(final boolean delete) {
        this.isDelete = delete;
    }

    public long getCreatedOn() {
        return this.createdOn;
    }

    public void setCreatedOn(final long createdOn) {
        this.createdOn = createdOn;
    }

    public long getUpdatedOn() {
        return this.updatedOn;
    }

    public void setUpdatedOn(final long updatedOn) {
        this.updatedOn = updatedOn;
    }
}
